#ifndef __PALYER_SLAVE_H__
#define __PALYER_SLAVE_H__

class PacketDecoder;
class PlayerSkill;
class PlayerSlave:public PlayerHome
{
public:
	PlayerSlave(PlayerId stPlayerId);
	virtual ~PlayerSlave();

	UInt32			m_nTimerSendSlaves;
	virtual void PrepareSendSlaves(){if(m_nTimerSendSlaves == 0) m_nTimerSendSlaves = CreateTimer(boost::bind(&PlayerSlave::OnTimerSendSlaves, this,_1),100);}
	void OnTimerSendSlaves(UInt32 nTimerId);

	bool addSlave(Int32 char_id);
	bool addSlave(SoulCharInfo& soulInfo);
	bool hasSlave(Int32 char_id);
	Slave* getSlaveByIndex(Int32 nIndex);
	Slave* getSlaveByInnerId(Int32 nInnerId);
	Slave* getSlaveByCharId(Int32 nCharId);
	Slave* getSlaveBySlaveId(Int32 nSlaveId);
	static SlaveInfo* getSlaveInfoByInnerId(CharInfo& stCharInfo,Int32 nInnerId);
	void removeSlaveBySlaveId(SlaveId id);
	void removeSlave(Int32 nCharId);
	void decodeSlaves();
	void encodeSlaves();
	void sendSlaves();
	void sendSlavesCatch();
	UInt32 getSlaveJoinBattleIndex(){return m_stCharInfo.m_nSlaveJoinBattleIndex;};
	void setSlaveJoinBattleIndex(Int32 nIndex){m_stCharInfo.m_nSlaveJoinBattleIndex = nIndex;};
	Slave* getSlaveJoinBattle(){return getSlaveByIndex(m_stCharInfo.m_nSlaveJoinBattleIndex);};
	Int32 generateSlaveInnerId();
	bool updateSlavesCatch();
	bool addSlaveCatch(SimpleCharInfo& simpleCharInfo);
	bool hasSlaveCatch(Int32 char_id);
protected:
	std::vector<SlaveId>	m_arSlaves;
};
#pragma pack()
#endif